// index.js

const { API_ASIAPD_URL } = require("../../utils/wxapi");
const wxapi = require("../../utils/wxapi");

Page({
  data: {
    bannerUrl: null
  },

  /**
   * 获取banner图
   */
  getBanner() {
    wxapi.getNewsMsgById({ id: 93 }).then(res => {
      if (res.status === 200) {
        this.setData({
          bannerUrl: API_ASIAPD_URL + res.data.smallPhotoUrl
        })
      }
    })
  },

  onLoad(options) {
    this.getBanner()
  },

  onShow() {
    if (typeof this.getTabBar === 'function' &&
      this.getTabBar()) {
      this.getTabBar().setData({
        selected: 0
      })
    }
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  },

  onShareTimeline() {

  }
})
